package zz.demo.springCloud.config.securityService;

import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;
import zz.demo.springCloud.entity.User;

import java.util.Collection;

/**
 * Created by zhangzheng on 2017-6-22.
 */
public class SecurityUser extends User implements UserDetails {

    private static final long serialVersionUID = 1L;

    public SecurityUser(User user){
        if(user!=null){
            this.setUsername(user.getUsername());
            this.setPassword(user.getPassword());
            this.setId(user.getId());
            this.setMessage(user.getMessage());
        }
    }

    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        return null;
    }

    @Override
    public boolean isAccountNonExpired() {
        return true;
    }

    @Override
    public boolean isAccountNonLocked() {
        return true;
    }

    @Override
    public boolean isCredentialsNonExpired() {
        return true;
    }

    @Override
    public boolean isEnabled() {
        return true;
    }
}
